import * as Types from "@/store/action-types.js";

const profileMutations = {
  [Types.SET_USER](state, payload) {
    state.username = payload.username;
    state.token = payload.token;
    state.authList = payload.authList;

    // cookie  /  localStorage
    if (payload.token) {
      // 存放token
      localStorage.setItem("token", payload.token);
    }
  },
  [Types.SET_PERMISSION](state, payload) {
    state.hasPermission = payload;
  },
};

export default profileMutations;
